package site.eblog.config;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

import site.eblog.security.MyAES;

public class MyPropertiesConfiguration extends PropertyPlaceholderConfigurer{

	//如果包含encrypt的属性就解密
	@Override  
    protected String convertProperty(String propertyName,String propertyValue){  
        if(propertyName.contains("encrypt")){  
            return getDecryptString(propertyValue);//调用解密方法  
        }else{  
            return propertyValue;  
        }  
    }
	
	private String getDecryptString(String value){
		String strAry= MyAES.decrypt(value);
		return new String(strAry);
		
	}
}
